home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 09 - 1993 / 09.08 Aug 93 / Other AppleScript Samples / Simple Drop Examples / Count Words.txt < prev    next >
Encoding:
Text File  |  1993-07-02  |  583 b   |  18 lines  |  [TEXT/ToyS]

  1. on open x
  2.     tell application "Scriptable Text Editor"
  3.         open x
  4.         set charCount to 0
  5.         set wordCount to 0
  6.         set paraCount to 0
  7.         repeat with i from 1 to number of documents
  8.             set charCount to charCount + (number of characters in document i)
  9.             set wordCount to wordCount + (number of words in document i)
  10.             set paraCount to paraCount + (number of paragraphs in document i)
  11.         end repeat
  12.         close documents saving no
  13.     end tell
  14.     display dialog "Total counts…" & return & ¬
  15.         "Chars : " & charCount & return & ¬
  16.         "Words : " & wordCount & return & ¬
  17.         "Paragraphs : " & paraCount
  18. end open